package demo.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloUsuarioServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		executar(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		executar(req, resp);
	}
	
	protected void executar(HttpServletRequest req, HttpServletResponse resp)
	throws ServletException, IOException {

		String nome = req.getParameter("nome");
		
		resp.sendRedirect("/servlet/jsp/helloNome.jsp?nome=" + nome);
	}


}
